package com.umeng.kaoti2.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.mvplibrary.mvplibrary.adapter.BaseAdapter;
import com.example.mvplibrary.mvplibrary.adapter.BaseViewHolder;
import com.umeng.kaoti2.R;
import com.umeng.kaoti2.data.HighOpinionBean;

import org.w3c.dom.Text;

import java.util.List;

public class FirstAdapter extends BaseAdapter<HighOpinionBean.ListBean> {

    public FirstAdapter(List<HighOpinionBean.ListBean> datas, Context context, int layoutId) {
        super(datas, context, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, HighOpinionBean.ListBean listBean, int position) {
        ImageView image_view = holder.getView(R.id.image_view);
        TextView text_name = holder.getView(R.id.text_name);
        TextView text_price = holder.getView(R.id.text_price);
        RecyclerView rlv_in = holder.getView(R.id.rlv_in);
        TextView tv_kp = holder.getView(R.id.tv_kedate);
        TextView tv_crie = holder.getView(R.id.cate_cire);
        TextView tv_shou = holder.getView(R.id.tv_shouname);
        tv_shou.setText(listBean.getCateStatus().getName());
        tv_kp.setText("开盘时间:"+listBean.getKpdate());
        tv_crie.setText(listBean.getArea_name()+"/");
        Glide.with(context).load(listBean.getThumb()).into(image_view);
        text_name.setText(listBean.getName());
        text_price.setText(listBean.getPrice());
        TextView tv_price_unit = holder.getView(R.id.tv_price_unit);
        tv_price_unit.setText(listBean.getPrice_unit());
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        rlv_in.setLayoutManager(linearLayoutManager);
        TwoAdapter rlvInAdapter = new TwoAdapter(datas,context,R.layout.layout_items);
        rlv_in.setAdapter(rlvInAdapter);
    }
}
